package com.rimi.controller;

import com.rimi.bean.Video;
import com.rimi.service.WatchService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class UserCollectionController {
    @Autowired
    private WatchService watchService;

    @RequestMapping("userCollection/{userId}")
    public String toUserCollection(@PathVariable Integer userId, Model m){
        List<Video> collection = watchService.getCollectionByUserId(userId);
        m.addAttribute("userCollection",collection);
        return "my_collection";
    }
}
